package demo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.wicket.extensions.yui.calendar.DatePicker;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.Model;
 

import com.medical.view.wicket.html.panal.MedPanel;

public class UserPanal1 extends MedPanel {
	private Model model;
	private Model myDateModel;

	public UserPanal1( String s)
	{
		super(s);
	FeedbackPanel feedback = new FeedbackPanel("feedyMesaasges");
	add(feedback);
	Form form = new Form("f")
	{
	private static final long serialVersionUID = 1L;

	protected void onSubmit()
	{
	String symbol = (String) model.getObject();
	Date curDate = (Date)myDateModel.getObject();

	int stock_val = symbol.hashCode()%100+ curDate.toString().hashCode();
	Result result = new Result(stock_val, symbol, curDate.toString());
	setResponsePage(result);
	}
	};

	model = new Model();
	List<String> listOfSymbols = new ArrayList<String>();
	listOfSymbols.add("HCLT");
	listOfSymbols.add("HCLComnet");
	DropDownChoice symbol = new DropDownChoice("sym",model,listOfSymbols);
	symbol.setRequired(true);
	form.add(symbol);

	myDateModel = new Model();
	TextField dateField = new TextField("mydate", myDateModel, Date.class);
	dateField.setRequired(true);
	dateField.add(new DatePicker());
	form.add(dateField);

	add(form);
	}
	}
